package com.spzx.product.api;

import com.spzx.product.api.domin.ProductSku;
import com.spzx.product.api.factory.RemoteProductFallbackFactory;
import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.constant.ServiceNameConstants;
import com.spzx.common.core.domain.R;
import com.spzx.product.vo.SkuPriceVo;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

//用来被扫描从而产生代理对象
@FeignClient(value = ServiceNameConstants.PRODUCT_SERVICE,
             path = "/productSku",
             fallbackFactory = RemoteProductFallbackFactory.class)  //fallbackFactory兜底对象发生错误直接返回兜底对象
public interface RemoteProductService {
    @Operation(summary = "获取商品SKU详情")
    @GetMapping("/getProductSku/{skuId}")
    public R<ProductSku> getProductSku(@PathVariable("skuId") Long skuId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @Operation(summary = "批量获取商品sku最新价格信息")
    @PostMapping("getSkuPriceList")
    public R<List<SkuPriceVo>> getskupricelist(@RequestBody List<Long> skuIds, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @Operation(summary = "获取单个商品sku最新价格信息")
    @GetMapping(value = "/getSkuPrice/{skuId}")
    public R<SkuPriceVo> getSkuPrice(@PathVariable("skuId") Long skuId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);



}
